package com.jsj.service.impl;

import com.jsj.mapper.AdminMapper;
import com.jsj.pojo.Admin;
import com.jsj.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    AdminMapper adminMapper;
    @Override
    public Admin queryAdmin(String username, String password, String duty) {

        Admin admin = adminMapper.queryAdmin(username, password, duty);
        return admin;
    }

    @Override
    public List<Admin> queryAllAdmin() {

        List<Admin> admins = adminMapper.queryAllAdmin();
        return admins;
    }

    @Override
    public Boolean updateByAdminId(Admin admin) {
        Boolean flag = adminMapper.updateByAdminId(admin);
        return flag;
    }

    @Override
    public Boolean addAdmin(Admin admin) {
        Boolean flag = adminMapper.addAdmin(admin);
        return flag;
    }

    @Override
    public Boolean deleteById(int id) {
        Boolean flag = adminMapper.deleteById(id);
        return flag;
    }

    @Override
    public Admin queryAdminById(int id) {
        Admin admin = adminMapper.queryAdminById(id);
        return admin;
    }

}
